﻿using System;
using System.Data;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using PolePositionMobileUtilityEntity.Logic;
using PolePositionMobileUtilityGeneral;

namespace PolePositionMobileUtilityEntity.Entities
{
    public class EVendor : EBaseLookup
    {
        private ECompany[] m_Companies;
        private EProject[] m_Projects;

        public EVendor()
        :base()
        {
            m_TableCollumnId = "VendorId";
            m_TableName = "tb_Vendor";
        }

        public EVendor(Int32 id)
            : this()
        {
            Id = id;
        }

        public EVendor(Int32 id, string name)
            :this(id)
        {
            Name = name;
        }

        public EVendor[] GetAll()
        {
            DataTable _dtVendor = SelectAll();
            EVendor[] arr = new EVendor[_dtVendor.Rows.Count];
            for (int i = 0; i < _dtVendor.Rows.Count; i++)
            {
                arr[i] = new EVendor(ConvertMobileHelper.ToInt32(_dtVendor.Rows[i][m_TableCollumnId]), ConvertMobileHelper.Tostring(_dtVendor.Rows[i][m_TableCollumnName]));
            }
            return arr;
        }
    }
}
